<?php

list($a, $b) = explode('.', '145.1523');
//string(3) "145"
//string(4) "1523"

$arr = [
    ['name' => 'dana', 'age' => 24, 'gander' => 'female'],
    ['name' => 'Jane', 'age' => 26, 'gander' => 'male'],
    ['name' => 'Json', 'age' => 28, 'gander' => 'male'],
];

list($a, $b, $c) = $arr;
var_dump($a, $b, $c);

/****************** 4.1 指定并发 从元素 0 开始的数组 ***************/

// 问题：希望一步为一个数组赋多个元素，不过不希望第一个元素的索引为 0

$presidents = [1 => 'washington', 3 => 'Adams', 2 => 'Jefferson', 'Madison'];
ksort($presidents);

// 打印一个总统列表

foreach ($presidents as $number => $president) {
    print  $number . ': ' . $president . PHP_EOL;
}

// 而不是这样
foreach ($presidents as $number => $president) {
    $number++;
    print $number . ': ' . $president . PHP_EOL;
}

// 这个特性并不局限于数字 1 也可以是任意的整数

$reconstruction_presidents = [16 => 'Lincoln', 'Johnson'];